Skip to content

🐛(backend) stream document content with an async iterator under ASGI#2381

Open
lunika wants to merge 2 commits into
mainfrom
fix/async-generator
Open

🐛(backend) stream document content with an async iterator under ASGI#2381
lunika wants to merge 2 commits into
mainfrom
fix/async-generator

Conversation

@lunika
Copy link
Copy Markdown
Member

@lunika lunika commented Jun 2, 2026

Purpose

When docs is ran using an ASGI server, the django StreamingHttpResponse expect to consume an async generator. If a sync generator is used, it fully consumes it and then return all the content and we loose the benefits of using a StreamingHttpResponse.

It fixes this warning :

/app/.venv/lib/python3.13/site-packages/django/core/handlers/asgi.py:336: Warning: StreamingHttpResponse must consume synchronous iterators in order to serve them asynchronously. Use an asynchronous iterator instead.

Proposal

  • 🐛(backend) stream document content with an async iterator under ASGI

@lunika lunika requested a review from qbey June 2, 2026 15:27
@lunika lunika self-assigned this Jun 2, 2026
@lunika lunika added the backend label Jun 2, 2026
lunika added 2 commits June 3, 2026 16:09
When docs is ran using an ASGI server, the django StreamingHttpResponse
expect to consume an async generator. If a sync generator is used, it
fully consumes it and then return all the content and we loose the
benefits of using a StreamingHttpResponse.
@lunika lunika force-pushed the fix/async-generator branch from dcde2a9 to 86d215b Compare June 3, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant